<!DOCTYPE html>
<html style="width: 100%; height: 100%;">
  <head>
    <meta charset="utf-8">
    <title>Test tracing UMD</title>
    <style>
      body {
        font-family: sans-serif;
      }
      ol {
        display: inline-flex;
        flex-direction: column;
        align-items: flex-start;
      }
      li {
        background-color: #F7F7F7;
        border: solid #CCC 0.125rem;
        margin-bottom: 0.5rem;
        border-radius: 0.25rem;
        padding: 0.5rem;
      }
      li:after {
        content: attr(data-value);
        margin-left: 0.25rem;
      }
      .correct {
        border-color: #0C0;
        border-style: solid;
        background: #EFE;
      }
      .incorrect {
        border-color: #F00;
        border-style: dashed;
        background-color: #FEE;
      }
    </style>
  </head>
  <body>
    <h1>Test tracing UMD</h1>
    <p>
      This fixture tests that the new tracing API is accessible via UMD build using the UMD shim.
      It does not exhaustively test API functionality, only that the forwarded methods can be called.
    </p>
    <p>
      Before running the tests below, check the console to make sure there are no errors.
    </p>
    <h3>
      Tests
      <button id="run-test-button" onClick="runAllTests()">Run all tests</button>
    </h3>
    <ol>
      <li id="checkSchedulerAPI" data-value="...">
        <strong>Test scheduler API</strong>
      </li>
      <li id="checkSchedulerTracingAPI" data-value="...">
        <strong>Test tracing API</strong>
      </li>
      <li id="checkSchedulerTracingSubscriptionsAPI" data-value="...">
        <strong>Test tracing subscriptions API</strong>
      </li>
      <li id="checkEndToEndIntegration" data-value="...">
        <strong>Test end-to-end integration</strong>
      </li>
    </ol>

    <script>
      if (window.location.search.includes('puppeteer=true')) {
        // Collocated calls to performance.now() often yield different values in Puppeteer.
        // This causes the Scheduler API test to fail.
        // For the purposes of our automated release scripts,
        // Coerce tests to use Date.now() instead to reduce the chances of a false positive.
        window.performance = {now: Date.now};
      }
    </script>

    <!-- Load the tracing API before react to test that it's lazily evaluated -->
    <script src="../../build/node_modules/scheduler/umd/scheduler.development.js"></script>
    <script src="../../build/node_modules/scheduler/umd/scheduler-tracing.development.js"></script>
    <script src="../../build/node_modules/react/umd/react.development.js"></script>
    <script src="../../build/node_modules/react-dom/umd/react-dom.development.js"></script>
    <script src="./script.js"></script>
  </body>
</html>
